    function shownavigate ()
    {
        if (pagecount<=1)
            return;
        var i=0;
        var navtable="";
        if (pagecount<=10)
        {
            for (i=1;i<=pagecount;i++)
            {
                if (i!=currentpage)
                    navtable+="&nbsp;<a href='javascript:showresult("+i+")'>"+i+"</a> ";
                	// navtable+="&nbsp;<a href='showallphotos.htm?page="+i+"'>"+i+"</a> ";
                else
                    navtable+=""+i+" ";
            }
            document.getElementById("navigate").innerHTML=navtable;
            return;
        }
        if (pagecount>10)
        {
            if (currentpage>1)
                navtable+="&nbsp;<a href='javascript:showresult(1);'>first</a> ";
            	//navtable+="&nbsp;<a href='showallphotos.htm?page=1'>first</a> ";
            if (currentpage>2)
            {
                navtable+="&nbsp;<a href='javascript:showresult("+(currentpage-1)+")'>pre</a> ";
            	// navtable+="&nbsp;<a href='showallphotos.htm?page="+(currentpage-1)+"'>pre</a> ";
            }
            if (currentpage<6)
            {
                for(i=1;i<10;i++)
                {
                    if(i!=currentpage)
                        navtable+="&nbsp;<a href='javascript:showresult("+i+")'>"+i+"</a>";
                    	//navtable+="&nbsp;<a href='showallphotos.htm?page="+i+"'>"+i+"</a>";
                    else
                        navtable+="&nbsp;"+i+" ";
                }
            }
            else
            {
                for(i=currentpage-4;i<=((currentpage+5)>pagecount?pagecount:(currentpage+5));i++)
                {
                    if(i!=currentpage)
                        navtable+="&nbsp;<a href='javascript:showresult("+i+")'>"+i+"</a>";
                    	//navtable+="&nbsp;<a href='showallphotos.htm?page="+i+"'>"+i+"</a>";
                    else
                        navtable+="&nbsp;"+i+" ";
                }
            }
            if (currentpage<pagecount-1)
            {
                navtable+="&nbsp;...";
            }
            if (currentpage<pagecount)
            {
                navtable+="&nbsp;<a href='javascript:showresult("+(currentpage+1)+");'>next</a> ";
                navtable+="&nbsp;<a href='javascript:showresult("+pagecount+")'>last</a> ";
            	//navtable+="&nbsp;<a href='showallphotos.htm?page="+(currentpage+1)+"'>next</a>
            	//navtable+="&nbsp;<a href='showallphotos.htm?page="+pagecount+"'>last</a> "; ";
            }
        }
        document.getElementById("navigate").innerHTML=navtable;
    };
function showresult (page){
createRequest();
request.open("GET",target+"?page="+page+"",true);
request.onreadystatechange = updatePage;
request.send(null);
}

function updatePage(){
if(request.readyState == 4 ){
   document.getElementById('resultdiv').innerHTML = request.responseText;
   pagecount=Number(request.getResponseHeader('pagecount'));
   resultcount=Number(request.getResponseHeader('resultcount'));
   currentpage=Number(request.getResponseHeader('currentpage'));
   //document.getElementById('test').innerHTML="pagecount:"+pagecount+"<br/>resultcount:"+resultcount+"<br/>currentpage:"+currentpage+"<br/>";
   shownavigate ();
}
}
// JavaScript Document